﻿namespace Webinator.Performance
{
    using System;

    public class PageTimings
    {
        public int FirstRequestToLastRequest { get; set; }

        public int PageLoaded { get; set; }

        public int DomLoaded { get; set; }

        public int Blocked { get; set; }

        public int Dns { get; set; }

        public int Connect { get; set; }

        public int Send { get; set; }

        public int Wait { get; set; }

        public int Receive { get; set; }

        public int Ssl { get; set; }

        public int Total { get { return Blocked + Dns + Connect + Send + Wait + Receive + Ssl; } }

        public double BlockedPercentage { get { return Math.Round(((double)Blocked / Total) * 100, 1); } }

        public double DnsPercentage { get { return Math.Round(((double)Dns / Total) * 100, 1); } }

        public double ConnectPercentage { get { return Math.Round(((double)Connect / Total) * 100, 1); } }

        public double SendPercentage { get { return Math.Round(((double)Send / Total) * 100, 1); } }

        public double WaitPercentage { get { return Math.Round(((double)Wait / Total) * 100, 1); } }

        public double ReceivePercentage { get { return Math.Round(((double)Receive / Total) * 100, 1); } }

        public double SslPercentage { get { return Math.Round(((double)Ssl / Total) * 100, 1); } }
    }
}
